Package-level declarations
Types
Wraps a lower level AI model and allows metadata to be attached to a model
Choose an LLM automatically: For example, in a platform, based on runtime analysis, or based on analysis of the prompt
Select an LLM by role
Estimates token count by dividing character length by a configurable characters-per-token ratio. The default ratio of 4 approximates tokenization for English text across most LLM tokenizers. Callers working with non-Latin scripts or code may supply a different ratio.
The platform's own EmbeddingRoleResolver, consulted after any the application registers.
Take LLM definitions from configuration
Configuration properties for the model provider
The platform's own RoleResolver, consulted after any the application registers.
Builds an EmbeddingService from a user-supplied key.
Where a user's key should be sent, and what the service built from it should say about itself.
Says where a user's key should be sent, for the providers this application knows about.
Builds an LlmService from a user-supplied key, for a wire protocol the framework has no client for.
Registered decision and classification services with their family defaults and role bindings.
Do not use in production code, this is just a lowest common denominator and example.
What an embedding role resolved to.
Decides what an embedding role means for a given call.
Embed text in vector space
Common hyperparameters for LLMs.
Metadata about a Large Language Model (LLM).
Portable LLM options.
Shared configuration options for all AI model providers. These properties apply across OpenAI, Anthropic, Bedrock, etc.
Metadata about an AI model. Pure data.
Provide AI models for requested roles, and expose data about available models.
What a RoleResolver gets to decide with, beyond the role name itself.
Makes the ModelSelectionContext for the current call available to model resolution without threading it through every LLM API. Applications set it at their request boundary - a servlet filter, an interceptor, or around the code that starts an agent process.
Superinterface for model selection criteria
Per-call native structured-output mode.
Exception thrown when no suitable model is found for the given criteria.
Convert our LLM options to Spring AI ChatOptions.
Pre-resolved model selection criteria that wraps an already-resolved service instance, bypassing ModelProvider resolution. Useful when the caller already has a concrete service instance, for example in BYOK (bring your own per-user key) scenarios, testing, or dynamic provider selection. The generic type parameter provides compile-time safety at the construction site, while the resolution site uses a single localized cast.
Represents a pricing model for an LLM. The models are usually per token pricing, differentiating between input and output tokens, or all you can eat, where there's an hourly rate for the model running whether or not it is in use. See OpenAI pricing
An API key for a named provider, supplied by a user rather than by deployment configuration.
What a role resolved to.
Decides what a role means for a given call.
Thrown when a service selection cannot be satisfied. The message names the request, the services and roles available to the family, the family default and the setting that fixes the selection.
Selects a service of one family by registration name, by role, by the family default, or by a supplied instance.
Wraps a Spring AI EmbeddingModel exposing an embedding service.
Estimate the number of tokens in content of type T. Implementations must be thread-safe, stateless, and never throw. Always returns >= 0.
Bounded transport categories for diagnostics. These do not choose a retry policy or a result. Unknown exception types produce other; exception messages never become category values. Adapter-specific invalid-response and SDK rate-limit recognition belong to the caller.
Properties
Functions
Read the native structured-output mode from LlmOptions.
Attach a native structured-output mode to LlmOptions.